package dnd.extension.base
{
	import dnd.extension.helper.*;
	import flash.display.*;
	import flash.text.*;
	import com.greensock.*;
	
	/**
	 * ...
	 * @author Hugh Hoang
	 */
	public class ControllerBase extends MovieClip
	{
		//Current view instance
		private var _currentView:ViewBase;
		private var _paused:Boolean;
		
		public function get timeLine():TimelineMax
		{
			return _currentView.timeLine;
		}
		
		public function set timeLine(value:TimelineMax):void
		{
			_currentView.timeLine = value;
		}
		
		public function get paused():Boolean
		{
			return _paused;
		}
		
		public function set paused(value:Boolean):void
		{
			_paused = value;
		}
		
		/**
		 * Project a view
		 * @param	view
		 */
		protected function View(view:ViewBase):void
		{
			_paused = false;
			if (_currentView != null)
			{
				removeChild(_currentView);
				_currentView = null;
			}
			//Swap to new view
			_currentView = view;
			addChild(_currentView);
		}
		
		/**
		 * Pause all animation
		 */
		public function Pause():void
		{
			timeLine.pause();
			_paused = true;
		}
		
		/**
		 * Resume all animation
		 */
		public function Resume():void
		{
			timeLine.resume();
			_paused = false;
		}
	
	}
}